package com.crime.crimemonitorclient;

import java.net.URL;

import android.location.Location;

import com.crimemonitor.library.CrimesSummary;

public class CrimeSummaryLoadingTaskFragment extends RetainedAsyncTaskFragment<CrimesSummary, OnCrimeSummaryLoaded>
{
	private URL					mServiceURL;
	private long				mStartDate;
	private long				mEndDate;
	private Location			mLocation;
	
	public final URL getServiceURL()
	{
		return this.mServiceURL;
	}

	public final void setServiceURL(URL serviceURL)
	{
		this.mServiceURL = serviceURL;
	}

	public final long getStartDate()
	{
		return this.mStartDate;
	}

	public final void setStartDate(long startDate)
	{
		this.mStartDate = startDate;
	}

	public final long getEndDate()
	{
		return this.mEndDate;
	}

	public final void setEndDate(long endDate)
	{
		this.mEndDate = endDate;
	}

	public final Location getLocation()
	{
		return this.mLocation;
	}

	public final void setLocation(Location location)
	{
		this.mLocation = location;
	}
	
	@Override
	protected RetainedAsyncTask<CrimesSummary> createTask()
	{
		return new GetCrimeSummaryAsyncTask(mServiceURL, mStartDate, mEndDate, mLocation, this);
	}
	
	@Override
	protected void callResultHandler(CrimesSummary result)
	{
		mResultHandler.onCrimeSummaryLoaded(result, this.mLocation);
	}

	@Override
	protected int getCancelledMessageResourceStringId()
	{
		return R.string.crime_summary_loading_cancelled;
	}
	
	@Override
	protected CharSequence getProgressDialogTitle()
	{
		return "";
	}
}
